package com.woniuxy.driverschool.service.impl;

import com.woniuxy.driverschool.entity.BatchCompleteStatus;
import com.woniuxy.driverschool.entity.Student;
import com.woniuxy.driverschool.mapper.StudentMapper;
import com.woniuxy.driverschool.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author shkstart
 * @create 2021-09-29 9:35
 */
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    StudentMapper studentMpper;
    //添加学员
    @Override
    public void insertStudent(Student student) {
        studentMpper.insertStudent(student);
    }
    //修改学员注册状态和时间
    @Override
    public void updateStudentRegisterDate(String register, Date regisDate, Integer sid) {
        studentMpper.updateStudentRegisterDate(register, regisDate, sid);
    }
    //单个修改学员结业状态和时间
    @Override
    public void updateStudentCompleteStatusDate(String completeStatus, Date completeDate, Integer sid) {
        studentMpper.updateStudentCompleteStatusDate(completeStatus, completeDate,sid );
    }
    //批量修改学员结业状态和时间
    @Override
    public void updateListStudentCompleteStatusDate(List<BatchCompleteStatus> batchCompleteStatus) {
        studentMpper.updateListStudentCompleteStatusDate(batchCompleteStatus);
    }
     //删除学员
    @Override
    public void deleteStudentById(Integer sid) {
        studentMpper.deleteStudentById(sid);
    }

    //根据id修改学员
    @Override
    public void updateStudentById(Student student) {
        studentMpper.updateStudentById(student);
    }

    //用id查询学员
    @Override
    public Student selectStudentBySid(Integer sid) {
        return studentMpper.selectStudentBySid(sid);
    }

    //分页查询学员
    @Override
    public List<Student> selectStudentsByPage(Student student, Integer pageIndex, Integer pageSize, Date startTime, Date endTime, Date completeStartTime, Date completeEndTime) {
        return studentMpper.selectStudentsByPage(student, pageIndex, pageSize, startTime, endTime,
                completeStartTime, completeEndTime);
    }
    //查询学员总条数
    @Override
    public int selectCountStudentsByPage(Student student, Date startTime, Date endTime, Date completeStartTime, Date completeEndTime) {
        return studentMpper.selectCountStudentsByPage(student, startTime, endTime,
                completeStartTime, completeEndTime);
    }

}
